

import hypermedia.video.*;

OpenCV opencv;

void setup() {

    size( 640, 480 );

    opencv = new OpenCV(this);
    opencv.capture( width, height );
    opencv.cascade( OpenCV.CASCADE_FRONTALFACE_ALT );    // load the FRONTALFACE description file
}

void draw() {
    
    opencv.read();
    PImage shot = opencv.image();
    image( shot, 0, 0 );
    
    int dimension = shot.width * shot.height;
    color pixel;
    
    for(int i = 0; i < dimension; i++)
    {
      pixel = shot.pixels[i];
      float bright = brightness(pixel);
      color newPixel;
      
      
      
      shot.pixels[i] = newPixel;
    }
    
    // detect anything ressembling a FRONTALFACE
    //Rectangle[] faces = opencv.detect(1.5, 2, OpenCV.HAAR_DO_CANNY_PRUNING, 40, 40);

    // draw detected face area(s)
    /*
    noFill();
    stroke(255,0,0);

    for( int i=0; i<faces.length; i++ ) {
        rect( faces[i].x, faces[i].y, faces[i].width, faces[i].height ); 
    }
    */  
}

